package com.edfu.core.coursemgt.persistence.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.edfu.core.institutemgt.persistence.entity.BatchEntity;
import com.edfu.core.institutemgt.persistence.entity.SectionMemberEntity;

@Entity
@Table(name="semester_batch_section")
public class BatchSectionEntity implements ICourseMgtEntity {
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private long id;
	
	@ManyToOne
	@JoinColumn(name="semester_batch_id", nullable=false)
	private BatchEntity batch;
	
	private String sectionName;
	private String sectionCode;
	
	@OneToMany(mappedBy = "section", fetch= FetchType.EAGER, cascade=CascadeType.ALL )
	private Set<SectionMemberEntity> members;
	
	private String startTime; //supports if each section start at different times

	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}

	public BatchEntity getBatch() {
		return batch;
	}
	public void setBatch(BatchEntity batch) {
		this.batch = batch;
	}
	
	public String getSectionName() {
		return sectionName;
	}
	public void setSectionName(String sectionName) {
		this.sectionName = sectionName;
	}

	public String getSectionCode() {
		return sectionCode;
	}
	public void setSectionCode(String sectionCode) {
		this.sectionCode = sectionCode;
	}

	public Set<SectionMemberEntity> getMembers() {
		return members;
	}
	public void setMembers(Set<SectionMemberEntity> members) {
		this.members = members;
	}
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}	
	
}
